import os

from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'shopping_mall.settings')

# 创建celery对象
app = Celery('celery_tasks')

# 设置 broker
app.config_from_object("celery_tasks.config")

# celery自动检测任务,这里会自动去celery_tasks.sms下tasks.py
app.autodiscover_tasks(['celery_tasks.sms', 'celery_tasks.email'])